
#pragma once

class IPCCallPacketBase;
class SendStoreReqIPCCallPacket;
class SendFetchReqIPCCallPacket;

enum INFO_IPCCALLMGR
{
	INFO_IPCCALLMGR_START																	=100000,

	INFO_IPCCALLMGR_INTERPROCESS_EXCEPTION													=100001,

	INFO_IPCCALLMGR_END																		=200000
};

enum ERROR_IPCCALLMGR
{
	ERROR_IPCCALLMGR_START																	=-100000,

	ERROR_IPCCALLMGR_INTERPROCESS_EXCEPTION													=-100001,

	ERROR_IPCCALLMGR_END																	=-200000
};

class IPCCallMgr : public asyframe::HandlerBase
{
public:
	IPCCallMgr();
	virtual ~IPCCallMgr();

	static const std::size_t maxMessageNumber = 100;
	static const std::size_t maxMessageSize = 1000;

	virtual retT init();
	virtual retT start();
	virtual retT close();

	retT processStoreReq();
	retT processFetchReq();
	retT processAppAttachReq();

	retT onSendStoreReq(boost::shared_ptr<SendStoreReqIPCCallPacket> _pSendStoreReqIPCCallPacket, reload::TransactionStatus _transactionStatus, boost::shared_ptr<reload::ReloadNetworkDataContext> _pReloadNetworkDataContext);
	retT onSendFetchReq(boost::shared_ptr<SendFetchReqIPCCallPacket> _pSendFetchReqIPCCallPacket, reload::TransactionStatus _transactionStatus, boost::shared_ptr<reload::ReloadNetworkDataContext> _pReloadNetworkDataContext);
	retT onSendAppAttachReq(boost::shared_ptr<IPCCallPacketBase> _pIPCCallPacketBase, reload::TransactionStatus _transactionStatus, boost::shared_ptr<reload::ReloadNetworkDataContext> _pReloadNetworkDataContext);

protected:
	boost::shared_ptr<asyframe::StaticThreadHandlerContext> pProcessStoreReqThreadHandlerContext_;
	boost::shared_ptr<asyframe::StaticThreadHandlerContext> pProcessFetchReqThreadHandlerContext_;
	boost::shared_ptr<asyframe::StaticThreadHandlerContext> pProcessAppAttachReqThreadHandlerContext_;
};
